home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 October: Mac OS SDK / Dev.CD Oct 00 SDK1.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / HFSVolumes.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  21.2 KB  |  535 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        HFSVolumes.h
  3.  
  4.      Contains:    On-disk data structures for HFS and HFS Plus volumes.
  5.  
  6.      Version:    Technology:    Mac OS 8.1
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1984-1999 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __HFSVOLUMES__
  18. #define __HFSVOLUMES__
  19.  
  20. #ifndef __MACTYPES__
  21.     #include <MacTypes.h>
  22. #endif
  23.  
  24. #ifndef __FILES__
  25.     #include <Files.h>
  26. #endif
  27.  
  28. #ifndef __FINDER__
  29.     #include <Finder.h>
  30. #endif
  31.  
  32.  
  33.  
  34.  
  35. #if PRAGMA_ONCE
  36. #pragma once
  37. #endif
  38.  
  39. #ifdef __cplusplus
  40. extern "C" {
  41. #endif
  42.  
  43. #if PRAGMA_IMPORT
  44. #pragma import on
  45. #endif
  46.  
  47. #if PRAGMA_STRUCT_ALIGN
  48.     #pragma options align=mac68k
  49. #elif PRAGMA_STRUCT_PACKPUSH
  50.     #pragma pack(push, 2)
  51. #elif PRAGMA_STRUCT_PACK
  52.     #pragma pack(2)
  53. #endif
  54.  
  55. /* Signatures used to differentiate between HFS and HFS Plus volumes */
  56. enum {
  57.     kHFSSigWord                    = 0x4244,                        /* 'BD' in ASCII */
  58.     kHFSPlusSigWord                = 0x482B,                        /* 'H+' in ASCII */
  59.     kHFSPlusVersion                = 0x0004,                        /* will change as format changes (version 4 shipped with Mac OS 8.1) */
  60.     kHFSPlusMountVersion        = FOUR_CHAR_CODE('8.10')        /* will change as implementations change ('8.10' in Mac OS 8.1) */
  61. };
  62.  
  63.  
  64. /* CatalogNodeID is used to track catalog objects */
  65. typedef UInt32                             HFSCatalogNodeID;
  66. enum {
  67.     kHFSMaxVolumeNameChars        = 27,
  68.     kHFSMaxFileNameChars        = 31,
  69.     kHFSPlusMaxFileNameChars    = 255
  70. };
  71.  
  72.  
  73. /* Extent overflow file data structures */
  74. /* HFS Extent key */
  75.  
  76. struct HFSExtentKey {
  77.     UInt8                             keyLength;                    /* length of key, excluding this field */
  78.     UInt8                             forkType;                    /* 0 = data fork, FF = resource fork */
  79.     HFSCatalogNodeID                 fileID;                        /* file ID */
  80.     UInt16                             startBlock;                    /* first file allocation block number in this extent */
  81. };
  82. typedef struct HFSExtentKey                HFSExtentKey;
  83. /* HFS Plus Extent key */
  84.  
  85. struct HFSPlusExtentKey {
  86.     UInt16                             keyLength;                    /* length of key, excluding this field */
  87.     UInt8                             forkType;                    /* 0 = data fork, FF = resource fork */
  88.     UInt8                             pad;                        /* make the other fields align on 32-bit boundary */
  89.     HFSCatalogNodeID                 fileID;                        /* file ID */
  90.     UInt32                             startBlock;                    /* first file allocation block number in this extent */
  91. };
  92. typedef struct HFSPlusExtentKey            HFSPlusExtentKey;
  93. /* Number of extent descriptors per extent record */
  94. enum {
  95.     kHFSExtentDensity            = 3,
  96.     kHFSPlusExtentDensity        = 8
  97. };
  98.  
  99. /* HFS extent descriptor */
  100.  
  101. struct HFSExtentDescriptor {
  102.     UInt16                             startBlock;                    /* first allocation block */
  103.     UInt16                             blockCount;                    /* number of allocation blocks */
  104. };
  105. typedef struct HFSExtentDescriptor        HFSExtentDescriptor;
  106. /* HFS Plus extent descriptor */
  107.  
  108. struct HFSPlusExtentDescriptor {
  109.     UInt32                             startBlock;                    /* first allocation block */
  110.     UInt32                             blockCount;                    /* number of allocation blocks */
  111. };
  112. typedef struct HFSPlusExtentDescriptor    HFSPlusExtentDescriptor;
  113. /* HFS extent record */
  114.  
  115. typedef HFSExtentDescriptor             HFSExtentRecord[3];
  116. /* HFS Plus extent record */
  117. typedef HFSPlusExtentDescriptor         HFSPlusExtentRecord[8];
  118.  
  119. /* Fork data info (HFS Plus only) - 80 bytes */
  120.  
  121. struct HFSPlusForkData {
  122.     UInt64                             logicalSize;                /* fork's logical size in bytes */
  123.     UInt32                             clumpSize;                    /* fork's clump size in bytes */
  124.     UInt32                             totalBlocks;                /* total blocks used by this fork */
  125.     HFSPlusExtentRecord             extents;                    /* initial set of extents */
  126. };
  127. typedef struct HFSPlusForkData            HFSPlusForkData;
  128. /* Permissions info (HFS Plus only) - 16 bytes */
  129.  
  130. struct HFSPlusPermissions {
  131.     UInt32                             ownerID;                    /* user or group ID of file/folder owner */
  132.     UInt32                             groupID;                    /* additional user of group ID */
  133.     UInt32                             permissions;                /* permissions (bytes: unused, owner, group, everyone) */
  134.     UInt32                             specialDevice;                /* UNIX: device for character or block special file */
  135. };
  136. typedef struct HFSPlusPermissions        HFSPlusPermissions;
  137. /* Catalog file data structures */
  138. enum {
  139.     kHFSRootParentID            = 1,                            /* Parent ID of the root folder */
  140.     kHFSRootFolderID            = 2,                            /* Folder ID of the root folder */
  141.     kHFSExtentsFileID            = 3,                            /* File ID of the extents file */
  142.     kHFSCatalogFileID            = 4,                            /* File ID of the catalog file */
  143.     kHFSBadBlockFileID            = 5,                            /* File ID of the bad allocation block file */
  144.     kHFSAllocationFileID        = 6,                            /* File ID of the allocation file (HFS Plus only) */
  145.     kHFSStartupFileID            = 7,                            /* File ID of the startup file (HFS Plus only) */
  146.     kHFSAttributesFileID        = 8,                            /* File ID of the attribute file (HFS Plus only) */
  147.     kHFSBogusExtentFileID        = 15,                            /* Used for exchanging extents in extents file */
  148.     kHFSFirstUserCatalogNodeID    = 16
  149. };
  150.  
  151.  
  152. /* HFS catalog key */
  153.  
  154. struct HFSCatalogKey {
  155.     UInt8                             keyLength;                    /* key length (in bytes) */
  156.     UInt8                             reserved;                    /* reserved (set to zero) */
  157.     HFSCatalogNodeID                 parentID;                    /* parent folder ID */
  158.     Str31                             nodeName;                    /* catalog node name */
  159. };
  160. typedef struct HFSCatalogKey            HFSCatalogKey;
  161. /* HFS Plus catalog key */
  162.  
  163. struct HFSPlusCatalogKey {
  164.     UInt16                             keyLength;                    /* key length (in bytes) */
  165.     HFSCatalogNodeID                 parentID;                    /* parent folder ID */
  166.     HFSUniStr255                     nodeName;                    /* catalog node name */
  167. };
  168. typedef struct HFSPlusCatalogKey        HFSPlusCatalogKey;
  169.  
  170. /* Catalog record types */
  171. enum {
  172.                                                                 /* HFS Catalog Records */
  173.     kHFSFolderRecord            = 0x0100,                        /* Folder record */
  174.     kHFSFileRecord                = 0x0200,                        /* File record */
  175.     kHFSFolderThreadRecord        = 0x0300,                        /* Folder thread record */
  176.     kHFSFileThreadRecord        = 0x0400,                        /* File thread record */
  177.                                                                 /* HFS Plus Catalog Records */
  178.     kHFSPlusFolderRecord        = 1,                            /* Folder record */
  179.     kHFSPlusFileRecord            = 2,                            /* File record */
  180.     kHFSPlusFolderThreadRecord    = 3,                            /* Folder thread record */
  181.     kHFSPlusFileThreadRecord    = 4                                /* File thread record */
  182. };
  183.  
  184.  
  185. /* Catalog file record flags */
  186. enum {
  187.     kHFSFileLockedBit            = 0x0000,                        /* file is locked and cannot be written to */
  188.     kHFSFileLockedMask            = 0x0001,
  189.     kHFSThreadExistsBit            = 0x0001,                        /* a file thread record exists for this file */
  190.     kHFSThreadExistsMask        = 0x0002
  191. };
  192.  
  193.  
  194. /* HFS catalog folder record - 70 bytes */
  195.  
  196. struct HFSCatalogFolder {
  197.     SInt16                             recordType;                    /* record type */
  198.     UInt16                             flags;                        /* folder flags */
  199.     UInt16                             valence;                    /* folder valence */
  200.     HFSCatalogNodeID                 folderID;                    /* folder ID */
  201.     UInt32                             createDate;                    /* date and time of creation */
  202.     UInt32                             modifyDate;                    /* date and time of last modification */
  203.     UInt32                             backupDate;                    /* date and time of last backup */
  204.     DInfo                             userInfo;                    /* Finder information */
  205.     DXInfo                             finderInfo;                    /* additional Finder information */
  206.     UInt32                             reserved[4];                /* reserved - set to zero */
  207. };
  208. typedef struct HFSCatalogFolder            HFSCatalogFolder;
  209. /* HFS Plus catalog folder record - 88 bytes */
  210.  
  211. struct HFSPlusCatalogFolder {
  212.     SInt16                             recordType;                    /* record type = HFS Plus folder record */
  213.     UInt16                             flags;                        /* file flags */
  214.     UInt32                             valence;                    /* folder's valence (limited to 2^16 in Mac OS) */
  215.     HFSCatalogNodeID                 folderID;                    /* folder ID */
  216.     UInt32                             createDate;                    /* date and time of creation */
  217.     UInt32                             contentModDate;                /* date and time of last content modification */
  218.     UInt32                             attributeModDate;            /* date and time of last attribute modification */
  219.     UInt32                             accessDate;                    /* date and time of last access (Rhapsody only) */
  220.     UInt32                             backupDate;                    /* date and time of last backup */
  221.     HFSPlusPermissions                 permissions;                /* permissions (for Rhapsody) */
  222.     DInfo                             userInfo;                    /* Finder information */
  223.     DXInfo                             finderInfo;                    /* additional Finder information */
  224.     UInt32                             textEncoding;                /* hint for name conversions */
  225.     UInt32                             reserved;                    /* reserved - set to zero */
  226. };
  227. typedef struct HFSPlusCatalogFolder        HFSPlusCatalogFolder;
  228. /* HFS catalog file record - 102 bytes */
  229.  
  230. struct HFSCatalogFile {
  231.     SInt16                             recordType;                    /* record type */
  232.     UInt8                             flags;                        /* file flags */
  233.     SInt8                             fileType;                    /* file type (unused ?) */
  234.     FInfo                             userInfo;                    /* Finder information */
  235.     HFSCatalogNodeID                 fileID;                        /* file ID */
  236.     UInt16                             dataStartBlock;                /* not used - set to zero */
  237.     SInt32                             dataLogicalSize;            /* logical EOF of data fork */
  238.     SInt32                             dataPhysicalSize;            /* physical EOF of data fork */
  239.     UInt16                             rsrcStartBlock;                /* not used - set to zero */
  240.     SInt32                             rsrcLogicalSize;            /* logical EOF of resource fork */
  241.     SInt32                             rsrcPhysicalSize;            /* physical EOF of resource fork */
  242.     UInt32                             createDate;                    /* date and time of creation */
  243.     UInt32                             modifyDate;                    /* date and time of last modification */
  244.     UInt32                             backupDate;                    /* date and time of last backup */
  245.     FXInfo                             finderInfo;                    /* additional Finder information */
  246.     UInt16                             clumpSize;                    /* file clump size (not used) */
  247.     HFSExtentRecord                 dataExtents;                /* first data fork extent record */
  248.     HFSExtentRecord                 rsrcExtents;                /* first resource fork extent record */
  249.     UInt32                             reserved;                    /* reserved - set to zero */
  250. };
  251. typedef struct HFSCatalogFile            HFSCatalogFile;
  252. /* HFS Plus catalog file record - 248 bytes */
  253.  
  254. struct HFSPlusCatalogFile {
  255.     SInt16                             recordType;                    /* record type = HFS Plus file record */
  256.     UInt16                             flags;                        /* file flags */
  257.     UInt32                             reserved1;                    /* reserved - set to zero */
  258.     HFSCatalogNodeID                 fileID;                        /* file ID */
  259.     UInt32                             createDate;                    /* date and time of creation */
  260.     UInt32                             contentModDate;                /* date and time of last content modification */
  261.     UInt32                             attributeModDate;            /* date and time of last attribute modification */
  262.     UInt32                             accessDate;                    /* date and time of last access (Rhapsody only) */
  263.     UInt32                             backupDate;                    /* date and time of last backup */
  264.     HFSPlusPermissions                 permissions;                /* permissions (for Rhapsody) */
  265.     FInfo                             userInfo;                    /* Finder information */
  266.     FXInfo                             finderInfo;                    /* additional Finder information */
  267.     UInt32                             textEncoding;                /* hint for name conversions */
  268.     UInt32                             reserved2;                    /* reserved - set to zero */
  269.  
  270.                                                                 /* start on double long (64 bit) boundry */
  271.     HFSPlusForkData                 dataFork;                    /* size and block data for data fork */
  272.     HFSPlusForkData                 resourceFork;                /* size and block data for resource fork */
  273. };
  274. typedef struct HFSPlusCatalogFile        HFSPlusCatalogFile;
  275. /* HFS catalog thread record - 46 bytes */
  276.  
  277. struct HFSCatalogThread {
  278.     SInt16                             recordType;                    /* record type */
  279.     SInt32                             reserved[2];                /* reserved - set to zero */
  280.     HFSCatalogNodeID                 parentID;                    /* parent ID for this catalog node */
  281.     Str31                             nodeName;                    /* name of this catalog node */
  282. };
  283. typedef struct HFSCatalogThread            HFSCatalogThread;
  284. /* HFS Plus catalog thread record -- 264 bytes */
  285.  
  286. struct HFSPlusCatalogThread {
  287.     SInt16                             recordType;                    /* record type */
  288.     SInt16                             reserved;                    /* reserved - set to zero */
  289.     HFSCatalogNodeID                 parentID;                    /* parent ID for this catalog node */
  290.     HFSUniStr255                     nodeName;                    /* name of this catalog node (variable length) */
  291. };
  292. typedef struct HFSPlusCatalogThread        HFSPlusCatalogThread;
  293.  
  294. /*
  295.       These are the types of records in the attribute B-tree.  The values were chosen
  296.       so that they wouldn't conflict with the catalog record types.
  297. */
  298. enum {
  299.     kHFSPlusAttrInlineData        = 0x10,                            /* if size <  kAttrOverflowSize */
  300.     kHFSPlusAttrForkData        = 0x20,                            /* if size >= kAttrOverflowSize */
  301.     kHFSPlusAttrExtents            = 0x30                            /* overflow extents for large attributes */
  302. };
  303.  
  304.  
  305. /*
  306.       HFSPlusAttrInlineData
  307.       For small attributes, whose entire value is stored within this one
  308.       B-tree record.
  309.       There would not be any other records for this attribute.
  310. */
  311.  
  312. struct HFSPlusAttrInlineData {
  313.     UInt32                             recordType;                    /*    = kHFSPlusAttrInlineData*/
  314.     UInt32                             reserved;
  315.     UInt32                             logicalSize;                /*    size in bytes of userData*/
  316.     UInt8                             userData[2];                /*    variable length; space allocated is a multiple of 2 bytes*/
  317. };
  318. typedef struct HFSPlusAttrInlineData    HFSPlusAttrInlineData;
  319. /*
  320.       HFSPlusAttrForkData
  321.       For larger attributes, whose value is stored in allocation blocks.
  322.       If the attribute has more than 8 extents, there will be additonal
  323.       records (of type HFSPlusAttrExtents) for this attribute.
  324. */
  325.  
  326. struct HFSPlusAttrForkData {
  327.     UInt32                             recordType;                    /*    = kHFSPlusAttrForkData*/
  328.     UInt32                             reserved;
  329.     HFSPlusForkData                 theFork;                    /*    size and first extents of value*/
  330. };
  331. typedef struct HFSPlusAttrForkData        HFSPlusAttrForkData;
  332. /*
  333.       HFSPlusAttrExtents
  334.       This record contains information about overflow extents for large,
  335.       fragmented attributes.
  336. */
  337.  
  338. struct HFSPlusAttrExtents {
  339.     UInt32                             recordType;                    /*    = kHFSPlusAttrExtents*/
  340.     UInt32                             reserved;
  341.     HFSPlusExtentRecord             extents;                    /*    additional extents*/
  342. };
  343. typedef struct HFSPlusAttrExtents        HFSPlusAttrExtents;
  344. /*    A generic Attribute Record*/
  345.  
  346. union HFSPlusAttrRecord {
  347.     UInt32                             recordType;
  348.     HFSPlusAttrInlineData             inlineData;
  349.     HFSPlusAttrForkData             forkData;
  350.     HFSPlusAttrExtents                 overflowExtents;
  351. };
  352. typedef union HFSPlusAttrRecord            HFSPlusAttrRecord;
  353. /* Key and node lengths */
  354. enum {
  355.     kHFSPlusExtentKeyMaximumLength = sizeof(HFSPlusExtentKey) - sizeof(UInt16),
  356.     kHFSExtentKeyMaximumLength    = sizeof(HFSExtentKey) - sizeof(UInt8),
  357.     kHFSPlusCatalogKeyMaximumLength = sizeof(HFSPlusCatalogKey) - sizeof(UInt16),
  358.     kHFSPlusCatalogKeyMinimumLength = kHFSPlusCatalogKeyMaximumLength - sizeof(HFSUniStr255) + sizeof(UInt16),
  359.     kHFSCatalogKeyMaximumLength    = sizeof(HFSCatalogKey) - sizeof(UInt8),
  360.     kHFSCatalogKeyMinimumLength    = kHFSCatalogKeyMaximumLength - sizeof(Str31) + sizeof(UInt8),
  361.     kHFSPlusCatalogMinNodeSize    = 4096,
  362.     kHFSPlusExtentMinNodeSize    = 512,
  363.     kHFSPlusAttrMinNodeSize        = 4096
  364. };
  365.  
  366.  
  367. /* HFS and HFS Plus volume attribute bits */
  368. enum {
  369.                                                                 /* Bits 0-6 are reserved (always cleared by MountVol call) */
  370.     kHFSVolumeHardwareLockBit    = 7,                            /* volume is locked by hardware */
  371.     kHFSVolumeUnmountedBit        = 8,                            /* volume was successfully unmounted */
  372.     kHFSVolumeSparedBlocksBit    = 9,                            /* volume has bad blocks spared */
  373.     kHFSVolumeNoCacheRequiredBit = 10,                            /* don't cache volume blocks (i.e. RAM or ROM disk) */
  374.     kHFSBootVolumeInconsistentBit = 11,                            /* boot volume is inconsistent (System 7.6 and later) */
  375.                                                                 /* Bits 12-14 are reserved for future use */
  376.     kHFSVolumeSoftwareLockBit    = 15,                            /* volume is locked by software */
  377.     kHFSVolumeHardwareLockMask    = 1 << kHFSVolumeHardwareLockBit,
  378.     kHFSVolumeUnmountedMask        = 1 << kHFSVolumeUnmountedBit,
  379.     kHFSVolumeSparedBlocksMask    = 1 << kHFSVolumeSparedBlocksBit,
  380.     kHFSVolumeNoCacheRequiredMask = 1 << kHFSVolumeNoCacheRequiredBit,
  381.     kHFSBootVolumeInconsistentMask = 1 << kHFSBootVolumeInconsistentBit,
  382.     kHFSVolumeSoftwareLockMask    = 1 << kHFSVolumeSoftwareLockBit,
  383.     kHFSMDBAttributesMask        = 0x8380
  384. };
  385.  
  386.  
  387. /* Master Directory Block (HFS only) - 162 bytes */
  388. /* Stored at sector #2 (3rd sector) */
  389.  
  390. struct HFSMasterDirectoryBlock {
  391.  
  392.                                                                 /* These first fields are also used by MFS */
  393.  
  394.     UInt16                             drSigWord;                    /* volume signature */
  395.     UInt32                             drCrDate;                    /* date and time of volume creation */
  396.     UInt32                             drLsMod;                    /* date and time of last modification */
  397.     UInt16                             drAtrb;                        /* volume attributes */
  398.     UInt16                             drNmFls;                    /* number of files in root folder */
  399.     UInt16                             drVBMSt;                    /* first block of volume bitmap */
  400.     UInt16                             drAllocPtr;                    /* start of next allocation search */
  401.     UInt16                             drNmAlBlks;                    /* number of allocation blocks in volume */
  402.     UInt32                             drAlBlkSiz;                    /* size (in bytes) of allocation blocks */
  403.     UInt32                             drClpSiz;                    /* default clump size */
  404.     UInt16                             drAlBlSt;                    /* first allocation block in volume */
  405.     UInt32                             drNxtCNID;                    /* next unused catalog node ID */
  406.     UInt16                             drFreeBks;                    /* number of unused allocation blocks */
  407.     Str27                             drVN;                        /* volume name */
  408.  
  409.                                                                 /* Master Directory Block extensions for HFS */
  410.  
  411.     UInt32                             drVolBkUp;                    /* date and time of last backup */
  412.     UInt16                             drVSeqNum;                    /* volume backup sequence number */
  413.     UInt32                             drWrCnt;                    /* volume write count */
  414.     UInt32                             drXTClpSiz;                    /* clump size for extents overflow file */
  415.     UInt32                             drCTClpSiz;                    /* clump size for catalog file */
  416.     UInt16                             drNmRtDirs;                    /* number of directories in root folder */
  417.     UInt32                             drFilCnt;                    /* number of files in volume */
  418.     UInt32                             drDirCnt;                    /* number of directories in volume */
  419.     SInt32                             drFndrInfo[8];                /* information used by the Finder */
  420.     UInt16                             drEmbedSigWord;                /* embedded volume signature (formerly drVCSize) */
  421.     HFSExtentDescriptor             drEmbedExtent;                /* embedded volume location and size (formerly drVBMCSize and drCtlCSize) */
  422.     UInt32                             drXTFlSize;                    /* size of extents overflow file */
  423.     HFSExtentRecord                 drXTExtRec;                    /* extent record for extents overflow file */
  424.     UInt32                             drCTFlSize;                    /* size of catalog file */
  425.     HFSExtentRecord                 drCTExtRec;                    /* extent record for catalog file */
  426. };
  427. typedef struct HFSMasterDirectoryBlock    HFSMasterDirectoryBlock;
  428. /* HFSPlusVolumeHeader (HFS Plus only) - 512 bytes */
  429. /* Stored at sector #2 (3rd sector) and second-to-last sector. */
  430.  
  431. struct HFSPlusVolumeHeader {
  432.     UInt16                             signature;                    /* volume signature == 'H+' */
  433.     UInt16                             version;                    /* current version is kHFSPlusVersion */
  434.     UInt32                             attributes;                    /* volume attributes */
  435.     UInt32                             lastMountedVersion;            /* implementation version which last mounted volume */
  436.     UInt32                             reserved;                    /* reserved - set to zero */
  437.  
  438.     UInt32                             createDate;                    /* date and time of volume creation */
  439.     UInt32                             modifyDate;                    /* date and time of last modification */
  440.     UInt32                             backupDate;                    /* date and time of last backup */
  441.     UInt32                             checkedDate;                /* date and time of last disk check */
  442.  
  443.     UInt32                             fileCount;                    /* number of files in volume */
  444.     UInt32                             folderCount;                /* number of directories in volume */
  445.  
  446.     UInt32                             blockSize;                    /* size (in bytes) of allocation blocks */
  447.     UInt32                             totalBlocks;                /* number of allocation blocks in volume (includes this header and VBM*/
  448.     UInt32                             freeBlocks;                    /* number of unused allocation blocks */
  449.  
  450.     UInt32                             nextAllocation;                /* start of next allocation search */
  451.     UInt32                             rsrcClumpSize;                /* default resource fork clump size */
  452.     UInt32                             dataClumpSize;                /* default data fork clump size */
  453.     HFSCatalogNodeID                 nextCatalogID;                /* next unused catalog node ID */
  454.  
  455.     UInt32                             writeCount;                    /* volume write count */
  456.     UInt64                             encodingsBitmap;            /* which encodings have been use  on this volume */
  457.  
  458.     UInt8                             finderInfo[32];                /* information used by the Finder */
  459.  
  460.     HFSPlusForkData                 allocationFile;                /* allocation bitmap file */
  461.     HFSPlusForkData                 extentsFile;                /* extents B-tree file */
  462.     HFSPlusForkData                 catalogFile;                /* catalog B-tree file */
  463.     HFSPlusForkData                 attributesFile;                /* extended attributes B-tree file */
  464.     HFSPlusForkData                 startupFile;                /* boot file */
  465. };
  466. typedef struct HFSPlusVolumeHeader        HFSPlusVolumeHeader;
  467. /* ---------- HFS and HFS Plus B-tree structures ---------- */
  468. /* BTNodeDescriptor -- Every B-tree node starts with these fields. */
  469.  
  470. struct BTNodeDescriptor {
  471.     UInt32                             fLink;                        /*    next node at this level*/
  472.     UInt32                             bLink;                        /*    previous node at this level*/
  473.     SInt8                             kind;                        /*    kind of node (leaf, index, header, map)*/
  474.     UInt8                             height;                        /*    zero for header, map; child is one more than parent*/
  475.     UInt16                             numRecords;                    /*    number of records in this node*/
  476.     UInt16                             reserved;                    /*    reserved; set to zero*/
  477. };
  478. typedef struct BTNodeDescriptor            BTNodeDescriptor;
  479. /* Constants for BTNodeDescriptor kind */
  480. enum {
  481.     kBTLeafNode                    = -1,
  482.     kBTIndexNode                = 0,
  483.     kBTHeaderNode                = 1,
  484.     kBTMapNode                    = 2
  485. };
  486.  
  487. /* BTHeaderRec -- The first record of a B-tree header node */
  488.  
  489. struct BTHeaderRec {
  490.     UInt16                             treeDepth;                    /*    maximum height (usually leaf nodes)*/
  491.     UInt32                             rootNode;                    /*    node number of root node*/
  492.     UInt32                             leafRecords;                /*    number of leaf records in all leaf nodes*/
  493.     UInt32                             firstLeafNode;                /*    node number of first leaf node*/
  494.     UInt32                             lastLeafNode;                /*    node number of last leaf node*/
  495.     UInt16                             nodeSize;                    /*    size of a node, in bytes*/
  496.     UInt16                             maxKeyLength;                /*    reserved*/
  497.     UInt32                             totalNodes;                    /*    total number of nodes in tree*/
  498.     UInt32                             freeNodes;                    /*    number of unused (free) nodes in tree*/
  499.     UInt16                             reserved1;                    /*    unused*/
  500.     UInt32                             clumpSize;                    /*    reserved*/
  501.     UInt8                             btreeType;                    /*    reserved*/
  502.     UInt8                             reserved2;                    /*    reserved*/
  503.     UInt32                             attributes;                    /*    persistent attributes about the tree*/
  504.     UInt32                             reserved3[16];                /*    reserved*/
  505. };
  506. typedef struct BTHeaderRec                BTHeaderRec;
  507. /* Constants for BTHeaderRec attributes */
  508. enum {
  509.     kBTBadCloseMask                = 0x00000001,                    /*    reserved*/
  510.     kBTBigKeysMask                = 0x00000002,                    /*    key length field is 16 bits*/
  511.     kBTVariableIndexKeysMask    = 0x00000004                    /*    keys in index nodes are variable length*/
  512. };
  513.  
  514.  
  515. #if PRAGMA_STRUCT_ALIGN
  516.     #pragma options align=reset
  517. #elif PRAGMA_STRUCT_PACKPUSH
  518.     #pragma pack(pop)
  519. #elif PRAGMA_STRUCT_PACK
  520.     #pragma pack()
  521. #endif
  522.  
  523. #ifdef PRAGMA_IMPORT_OFF
  524. #pragma import off
  525. #elif PRAGMA_IMPORT
  526. #pragma import reset
  527. #endif
  528.  
  529. #ifdef __cplusplus
  530. }
  531. #endif
  532.  
  533. #endif /* __HFSVOLUMES__ */
  534.  
  535.